package day16;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class mapPractice {
    public static void main(String[] args) {
        Map<Integer,String> Hero=new HashMap<>();
        Hero.put(1,"提莫");
        Hero.put(2,"盖伦");
        Hero.put(3,"盲僧");
        Hero.put(4,"亚索");
        System.out.println(Hero);
        Set<Map.Entry<Integer, String>> entrySet = Hero.entrySet();
        Iterator<Map.Entry<Integer, String>> it = entrySet.iterator();
        while (it.hasNext()){
            Map.Entry<Integer, String> entry = it.next();
            Integer key = entry.getKey();
            String value = entry.getValue();
            System.out.println("{"+key+","+value+"}");
        }
        System.out.println("************");
        Set<Integer> keySet = Hero.keySet();
        Iterator<Integer> it2 = keySet.iterator();
        while (it2.hasNext()){
            Integer key = it2.next();
            String value = Hero.get(key);
            System.out.println("{"+key+","+value+"}");
        }
        System.out.println("************");
        Set<Map.Entry<Integer, String>> entrySet1 = Hero.entrySet();
        Iterator<Map.Entry<Integer, String>> it3 = entrySet1.iterator();
        while (it3.hasNext()){
            Map.Entry<Integer, String> entry = it3.next();
            Integer key = entry.getKey();
            String value = entry.getValue();
            System.out.println("{"+key+","+value+"}");
        }
        System.out.println("************");
        Set<Integer> keySet1 = Hero.keySet();
        Iterator<Integer> it4 = keySet1.iterator();
        while (it4.hasNext()){
            Integer key = it4.next();
            String value = Hero.get(key);
            System.out.println("{"+key+","+value+"}");
        }
        System.out.println("************");
        Set<Map.Entry<Integer, String>> entrySet2 = Hero.entrySet();
        Iterator<Map.Entry<Integer, String>> it5 = entrySet2.iterator();
        while (it5.hasNext()){
            Map.Entry<Integer, String> entry = it5.next();
            Integer key = entry.getKey();
            String value = entry.getValue();
            System.out.println("{"+key+","+value+"}");
        }
        System.out.println("************");
        Set<Integer> keySet2 = Hero.keySet();
        Iterator<Integer> it6 = keySet2.iterator();
        while (it6.hasNext()){
            Integer key = it6.next();
            String value = Hero.get(key);
            System.out.println("{"+key+","+value+"}");
        }
    }
}
